package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkCalcElement;
import com.ysd.lis.service.WkCalcElementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 试卷列表 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2024-04-19
 */
@RestController
@RequestMapping("/wk/calc/element")
public class WkCalcElementController extends BaseController {

    @Autowired
    WkCalcElementService wkCalcElementService;

    @GetMapping("/getCalcElementList")
    public Result getCalcElementList(@RequestParam(value = "keyWord", required = false) String keyWord) {
        return wkCalcElementService.getCalcElementList(keyWord);
    }

    @GetMapping("/findTableNamesByDataBase")
    public Result findTableNamesByDataBase(@RequestParam(value = "dataBaseName") String dataBaseName) {
        return wkCalcElementService.findTableNamesByDataBase(dataBaseName);
    }

    @GetMapping("/findColumnsByTableName")
    public Result findColumnsByTableName(@RequestParam(value = "tableName") String tableName) {
        return wkCalcElementService.findColumnsByTableName(tableName);
    }

    @PostMapping("/addCalcElement")
    public Result addCalcElement(@RequestBody WkCalcElement wkCalcElement) {
        return wkCalcElementService.addCalcElement(wkCalcElement);
    }

    @PostMapping("/editCalcElement")
    public Result editCalcElement(@RequestBody WkCalcElement wkCalcElement) {
        return wkCalcElementService.editCalcElement(wkCalcElement);
    }

    @PostMapping("/deleteCalcElement")
    public Result deleteCalcElement(@RequestBody List<String> ids) {
        return wkCalcElementService.deleteCalcElement(ids);
    }
}
